<template>
  <div class="SearchBlock"
    :class="type">
    <slot></slot>
    <div class="search-buttons">
      <slot name="button"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "SearchBlock",
  props: {
    type: String
  }
}
</script>

<style scoped lang="less">
.SearchBlock{
  //border: @common-border;
  border-radius: 4px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  >.el-form{
    display: inline-block;
    /deep/.el-form-item{
      margin-bottom: 0;
    }
  }
  >.search-buttons{
    display: inline-block;
    align-self: flex-start;
    >*:not(:first-child){
      margin-left: 10px;
    }
  }
  &.flex{
    padding-bottom: 0;
    >.el-form{
      display: flex;
      justify-content: space-between;
      /deep/ .el-form-item{
        display: inline-flex;
        margin-right: 2vw;
        .el-form-item__label{
          flex-shrink: 0;
        }
        .el-form-item__content{
          flex-grow: 2;
          >*{
            width: auto;
          }
        }
      }
    }
    >.search-buttons{
      flex-shrink: 0;
    }
  }
  &.block{
    padding-bottom: 0;
    display: block;
    >.el-form{
      display: flex;
      justify-content: space-between;
      /deep/ .el-form-item{
        display: inline-flex;
        margin-right: 2vw;
        .el-form-item__label{
          flex-shrink: 0;
        }
        .el-form-item__content{
          flex-grow: 2;
          display: inline-flex;
        }
      }
    }
  }
  &.wrap-block{
    padding-bottom: 0;
    display: block;
    >.el-form{
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      /deep/ .el-form-item{
        display: inline-flex;
        padding-right: 2vw;
        margin-right: 0;
        margin-bottom: 10px;
        .el-form-item__label{
          flex-shrink: 0;
        }
        .el-form-item__content{
          flex-grow: 2;
          >*{
            width: 100%;
          }
        }
      }
    }
    >.search-buttons{
      margin-top: 10px;
    }
  }
  &.half{
    padding-bottom: 0;
    >.el-form{
      flex-grow: 2;
      display: flex;
      flex-wrap: wrap;
      /deep/ .el-form-item{
        width: 50%;
        margin: 0 0 10px;
        padding-right: 10px;
        display: flex;
        .el-form-item__label{
          flex-shrink: 0;
        }
        .el-form-item__content{
          flex-grow: 2;
        }
      }
    }
    >.search-buttons{
      flex-shrink: 0;
    }
  }
}
</style>